package day_2023_7_to_10;

/**
 * @author haomin
 * @date 2023/08/20 23:31
 **/
public class Day_8_20 {
    class Solution {
        public int lastRemaining(int n, int m) {
            int ind = 0;
            for(int i = 2; i <= n; ++i){
                ind = (ind + m) % i;
            }
            return ind;
        }
    }
}